Skip to content

Conversation

@AndreiEres
Copy link
Contributor

@AndreiEres AndreiEres commented Oct 8, 2025

Description

Limits the size of statements that are further gossiped over the network to prevent skipping oversized messages. The limit is set to match the network protocol's max statement notification size (1 MB), accounting for 1-byte vector length overhead because statements are sent as Vec<Statement>.

Integration

Affected crates:

  • sc-statement-store: Now depends on sc-network-statement for size constants
  • sc-network-statement: MAX_STATEMENT_NOTIFICATION_SIZE is now public

For downstream users:

  • Statements larger than 1 MB will now be rejected earlier before the validation pipeline

@AndreiEres AndreiEres added the T0-node This PR/Issue is related to the topic “node”. label Oct 8, 2025
@AndreiEres
Copy link
Contributor Author

/cmd prdoc --audience node_dev --bump minor

@AndreiEres AndreiEres changed the base branch from master to AndreiEres/fix-statement-store-gossiping October 16, 2025 08:44
@paritytech-workflow-stopper
Copy link

All GitHub workflows were cancelled due to failure one of the required jobs.
Failed workflow url: https://github.com/paritytech/polkadot-sdk/actions/runs/18555597226
Failed job name: test-linux-stable

github-merge-queue bot pushed a commit that referenced this pull request Oct 16, 2025
# Description

Fixes gossiping and scalability issues in the statement-store
networking.

1. Reduced gossiping traffic by propagating only recent statements
instead of all.
2. Added an early check for statements that the node already has to skip
duplicate processing.
3. Added splitting of large statement batches to stay under
MAX_STATEMENT_NOTIFICATION_SIZE; oversized individual statements are
skipped.
4. MAX_STATEMENT_NOTIFICATION_SIZE was updated to the commonly used 1MB,
which drastically improved the gossiping speed.
5. Notifications are sent asynchronously. I don't see much difference in
performance, but according to @lexnv, it's better to do:
#9296.
6. Added a 10s timeout to handle very slow or disconnected peers.

## Integration

Internal optimizations to the gossip protocol. No downstream changes
required.

Related PR: #9965

## Things to handle in further PRs
- After this PR, nodes don't send all statements to new peers anymore,
only the recent ones.
- After restarting, the node doesn't re-gossip statements it wasn't
gossiped.
- Broadcasting notifications to all peers when the first peer is slow is
limited. We could instead use a FuturesUnordered.

---------

Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Bastian Köcher <[email protected]>
Base automatically changed from AndreiEres/fix-statement-store-gossiping to master October 16, 2025 16:18
alvicsam pushed a commit that referenced this pull request Oct 17, 2025
# Description

Fixes gossiping and scalability issues in the statement-store
networking.

1. Reduced gossiping traffic by propagating only recent statements
instead of all.
2. Added an early check for statements that the node already has to skip
duplicate processing.
3. Added splitting of large statement batches to stay under
MAX_STATEMENT_NOTIFICATION_SIZE; oversized individual statements are
skipped.
4. MAX_STATEMENT_NOTIFICATION_SIZE was updated to the commonly used 1MB,
which drastically improved the gossiping speed.
5. Notifications are sent asynchronously. I don't see much difference in
performance, but according to @lexnv, it's better to do:
#9296.
6. Added a 10s timeout to handle very slow or disconnected peers.

## Integration

Internal optimizations to the gossip protocol. No downstream changes
required.

Related PR: #9965

## Things to handle in further PRs
- After this PR, nodes don't send all statements to new peers anymore,
only the recent ones.
- After restarting, the node doesn't re-gossip statements it wasn't
gossiped.
- Broadcasting notifications to all peers when the first peer is slow is
limited. We could instead use a FuturesUnordered.

---------

Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Bastian Köcher <[email protected]>
@gui1117 gui1117 added this pull request to the merge queue Oct 22, 2025
Merged via the queue into master with commit de740e1 Oct 22, 2025
246 checks passed
@gui1117 gui1117 deleted the AndreiEres/max-statement-size branch October 22, 2025 02:00
@gui1117 gui1117 added A4-backport-stable2506 Pull request must be backported to the stable2506 release branch A4-backport-stable2509 Pull request must be backported to the stable2509 release branch labels Oct 22, 2025
@paritytech-release-backport-bot

Created backport PR for stable2506:

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin backport-9965-to-stable2506
git worktree add --checkout .worktree/backport-9965-to-stable2506 backport-9965-to-stable2506
cd .worktree/backport-9965-to-stable2506
git reset --hard HEAD^
git cherry-pick -x de740e1892f47e91c356858324f6e3e4b0f1be60
git push --force-with-lease

@paritytech-release-backport-bot

Created backport PR for stable2509:

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin backport-9965-to-stable2509
git worktree add --checkout .worktree/backport-9965-to-stable2509 backport-9965-to-stable2509
cd .worktree/backport-9965-to-stable2509
git reset --hard HEAD^
git cherry-pick -x de740e1892f47e91c356858324f6e3e4b0f1be60
git push --force-with-lease

gui1117 pushed a commit that referenced this pull request Oct 22, 2025
Fixes gossiping and scalability issues in the statement-store
networking.

1. Reduced gossiping traffic by propagating only recent statements
instead of all.
2. Added an early check for statements that the node already has to skip
duplicate processing.
3. Added splitting of large statement batches to stay under
MAX_STATEMENT_NOTIFICATION_SIZE; oversized individual statements are
skipped.
4. MAX_STATEMENT_NOTIFICATION_SIZE was updated to the commonly used 1MB,
which drastically improved the gossiping speed.
5. Notifications are sent asynchronously. I don't see much difference in
performance, but according to @lexnv, it's better to do:
#9296.
6. Added a 10s timeout to handle very slow or disconnected peers.

Internal optimizations to the gossip protocol. No downstream changes
required.

Related PR: #9965

- After this PR, nodes don't send all statements to new peers anymore,
only the recent ones.
- After restarting, the node doesn't re-gossip statements it wasn't
gossiped.
- Broadcasting notifications to all peers when the first peer is slow is
limited. We could instead use a FuturesUnordered.

---------

Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Bastian Köcher <[email protected]>
(cherry picked from commit b21cbb5)
@gui1117 gui1117 added the A4-backport-unstable2507 Pull request must be backported to the unstable2507 release branch label Oct 22, 2025
@paritytech-release-backport-bot

Created backport PR for unstable2507:

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin backport-9965-to-unstable2507
git worktree add --checkout .worktree/backport-9965-to-unstable2507 backport-9965-to-unstable2507
cd .worktree/backport-9965-to-unstable2507
git reset --hard HEAD^
git cherry-pick -x de740e1892f47e91c356858324f6e3e4b0f1be60
git push --force-with-lease

gui1117 added a commit that referenced this pull request Nov 4, 2025
Backport #9965 into `stable2509` from AndreiEres.

See the
[documentation](https://github.com/paritytech/polkadot-sdk/blob/master/docs/BACKPORT.md)
on how to use this bot.

<!--
  # To be used by other automation, do not modify:
  original-pr-number: #${pull_number}
-->

---------

Co-authored-by: Andrei Eres <[email protected]>
Co-authored-by: gui1117 <[email protected]>
Co-authored-by: Guillaume Thiolliere <[email protected]>
EgorPopelyaev added a commit that referenced this pull request Nov 6, 2025
Backport #9965 into `stable2506` from AndreiEres.

See the
[documentation](https://github.com/paritytech/polkadot-sdk/blob/master/docs/BACKPORT.md)
on how to use this bot.

<!--
  # To be used by other automation, do not modify:
  original-pr-number: #${pull_number}
-->

---------

Co-authored-by: Andrei Eres <[email protected]>
Co-authored-by: gui1117 <[email protected]>
Co-authored-by: Egor_P <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A4-backport-stable2506 Pull request must be backported to the stable2506 release branch A4-backport-stable2509 Pull request must be backported to the stable2509 release branch A4-backport-unstable2507 Pull request must be backported to the unstable2507 release branch T0-node This PR/Issue is related to the topic “node”.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants